/**
 * token检测
 * @param {Object} 传 this (Vue) 
 */
export default async (_this) => {
	let userinfo = uni.getStorageSync('userinfo');
	if(!userinfo) return false;
	
	let [err, {data}] = await uni.request({
		url: `${_this.$baseApi}checktoken`,
		header: {
			authorization: userinfo.token
		}
	})
	console.log(data);
	
	if(data.msg != '登录有效'){
		uni.removeStorageSync('userinfo');
		return false;
	}
	
	uni.setTabBarItem({
		index: 3,
		text: '我的'
	});
	
	return true;
	
}